import request from '@/utils/request'

// 查询直接映射列表
export function listDirectMapping(query) {
  return request({
    url: '/data/direct_mapping/list',
    method: 'get',
    params: query
  })
}

// 查询直接映射详细
export function getDirectMapping(id) {
  return request({
    url: '/data/direct_mapping/' + id,
    method: 'get'
  })
}

// 新增直接映射
export function addDirectMapping(data) {
  return request({
    url: '/data/direct_mapping',
    method: 'post',
    data: data
  })
}

// 修改直接映射
export function updateDirectMapping(data) {
  return request({
    url: '/data/direct_mapping',
    method: 'put',
    data: data
  })
}

// 删除直接映射
export function delDirectMapping(id) {
  return request({
    url: '/data/direct_mapping/del/' + id,
    method: 'delete'
  })
}

// 批量删除直接映射
export function removeDirectMapping(ids) {
  return request({
    url: '/data/direct_mapping/' + ids,
    method: 'delete'
  })
}

// 根据结构ID获取映射列表
export function getDirectMappingBySid(sid) {
  return request({
    url: '/data/direct_mapping/struct/' + sid,
    method: 'get'
  })
}

// 根据结构需求ID获取映射列表
export function getDirectMappingBySdid(sdid) {
  return request({
    url: '/data/direct_mapping/demand/' + sdid,
    method: 'get'
  })
}

// 根据结构指标ID获取映射列表
export function getDirectMappingBySiid(siid) {
  return request({
    url: '/data/direct_mapping/indicator/' + siid,
    method: 'get'
  })
}

// 检查文本类型需求是否已被映射
export function checkDemandMapped(sdid) {
  return request({
    url: '/data/direct_mapping/check/demand/' + sdid,
    method: 'get'
  })
}

// 检查文本类型技术指标是否已被映射
export function checkIndicatorMapped(siid) {
  return request({
    url: '/data/direct_mapping/check/indicator/' + siid,
    method: 'get'
  })
}

// 根据结构ID获取所有文本类型的映射
export function getTextTypeMappingsBySid(sid) {
  return request({
    url: '/data/direct_mapping/text/' + sid,
    method: 'get'
  })
}

// 检查需求和技术指标的组合是否已存在映射
export function checkMappingExists(sid, sdid, siid) {
  return request({
    url: '/data/direct_mapping/check/exists',
    method: 'get',
    params: {
      sid: sid,
      sdid: sdid,
      siid: siid
    }
  })
} 